package com.kehao.others.tencent;

import java.util.PriorityQueue;
import java.util.Scanner;

public class Question1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[][] array = new char[n][];
        for (int i = 0; i < n; i++) {
            array[i] = sc.next().toCharArray();
        }
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for (int i = 0; i < array[0].length; i++) {
            StringBuffer sb = new StringBuffer();
            for (int j = 0; j < n; j++) {
                sb.append(array[j][i]);
            }
            int num = Integer.parseInt(sb.toString());
            queue.add(num);
        }
        while (!queue.isEmpty()){
            System.out.print(queue.poll()+" ");
        }
    }
}
